home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / EDUCATION / WINDOW / h / WimpIcon < prev    next >
Text File  |  1998-04-05  |  3KB  |  140 lines

  1.  
  2. //-----------------------------------
  3. //             WimpIcon.h
  4. //-----------------------------------
  5.  
  6.  
  7. #ifndef WimpIcon_H
  8. #define WimpIcon_H
  9.  
  10. #include "IconData.h"
  11. #include "WimpWindow.h"
  12.     
  13. enum buttontype {                /* button types */
  14.      BIGNORE,               /* ignore all mouse ops */
  15.      BNOTIFY,
  16.      BCLICKAUTO,
  17.      BCLICKDEBOUNCE,
  18.      BSELREL,
  19.      BSELDOUBLE,
  20.      BDEBOUNCEDRAG,
  21.      BRELEASEDRAG,
  22.      BDOUBLEDRAG,
  23.      BSELNOTIFY,
  24.      BCLICKDRAGDOUBLE,
  25.      BCLICKSEL,              /* useful for on/off and radio buttons */
  26.      BWRITABLE = 15
  27.      } ;
  28.  
  29.           
  30. class WimpIcon
  31. {
  32.   friend class MenuItem;
  33.   friend class WimpMenu;
  34.   friend class WimpWindow;
  35.   
  36.   public:
  37.   
  38.   enum Flags {                  /* icon flag set */
  39.      ITEXT      = 0x00000001,     /* icon contains text */
  40.      ISPRITE    = 0x00000002,     /* icon is a sprite */
  41.      IBORDER    = 0x00000004,     /* icon has a border */
  42.      IHCENTRE   = 0x00000008,     /* text is horizontally centred */
  43.      IVCENTRE   = 0x00000010,     /* text is vertically centred */
  44.      IFILLED    = 0x00000020,     /* icon has a filled background */
  45.      IFONT      = 0x00000040,     /* text is an anti-aliased font */
  46.      IREDRAW    = 0x00000080,     /* redraw needs application's help */
  47.      INDIRECT   = 0x00000100,     /* icon data is 'indirected' */
  48.      IRJUST     = 0x00000200,     /* text right justified in box */
  49.      IESG_NOC   = 0x00000400,     /* if selected by right button, don't
  50.                                    * cancel other icons in same ESG */
  51.      IHALVESPRITE=0x00000800,     /* plot sprites half-size */
  52.      IBTYPE     = 0x00001000,     /* 4-bit field: button type */
  53.      ISELECTED  = 0x00200000,     /* icon selected by user (inverted) */
  54.      INOSELECT  = 0x00400000,     /* icon cannot be selected (shaded) */
  55.      IDELETED   = 0x00800000,     /* icon has been deleted */
  56.      IFORECOL   = 0x01000000,     /* 4-bit field: foreground colour */
  57.      IBACKCOL   = 0x10000000      /* 4-bit field: background colour */
  58.      } ;
  59.        
  60.   private:
  61.   
  62.   int window_handle;
  63.   int handle;
  64.   int xmin;
  65.   int ymin;
  66.   int xmax;
  67.   int ymax;
  68.   int flags;
  69.   union
  70.   {
  71.     char text[12];
  72.     char sprite_name[12];
  73.     struct
  74.     {
  75.       char *text;
  76.       char *filter;
  77.       int text_lenght;
  78.     } indirect_text;
  79.     struct
  80.     {
  81.       union
  82.       {
  83.       int *sprite;
  84.       char *sprite_name;
  85.       };
  86.       int *sprite_area;
  87.       int isname;
  88.     }indirect_sprite;
  89.     struct
  90.     {
  91.       char *text;
  92.       char *filter;
  93.       int text_lenght;
  94.     }indirect;
  95.   };
  96.  
  97.   IconBlock *data;
  98.  
  99.   public:
  100.   
  101.   enum Direction
  102.    {
  103.    UP,
  104.    DOWN,
  105.    LEFT,
  106.    RIGHT
  107.    } ;
  108.   
  109.   WimpIcon(WimpIcon &, 
  110.            int = ISPRITE + INDIRECT + IHCENTRE + IBTYPE*BCLICKDEBOUNCE,
  111.            int = -1, int = 0,
  112.            int = 0, int = 0, int = 70, int = 76);
  113.   WimpIcon(char *, 
  114.            int = ISPRITE + IHCENTRE + IBTYPE*BCLICKDEBOUNCE,
  115.            int = -1, int = 0,
  116.            int = 0, int = 0, int = 70, int = 76);  
  117.            
  118. /*  WimpIcon(Sprite &, 
  119.            int = ISPRITE + INDIRECT + IHCENTRE + IBTYPE*BCLICKDEBOUNCE,
  120.            int = -1, int = 0
  121.            int = 0, int = 0, int = 70, int = 76);   */
  122.         
  123.   WimpIcon(WimpWindow &, int);   
  124.                    
  125.   ~WimpIcon();
  126.   
  127.   operator int();
  128.   
  129.   void Delete();
  130.   void GetState();
  131.   void drag();
  132.   void write(char *, ...);
  133.   void read(char *);
  134. };
  135.  
  136. #endif
  137.  
  138.  
  139.  
  140.